/* eslint-disable @typescript-eslint/no-explicit-any */
import { watermark } from './src'

export default {
  name: 'watermark',
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
  install: (app: any, options: Record<string, any>):void => {
    const defaultOptions = {
      title: '诗和远方',
      container: document.body,
      needTime: false,
      timeFormat: 'yyyy-MM-dd hh:mm',
      width: '200px',
      height: '100px',
      fontSize: '12px',
      fontColor: 'black',
      opacity: '0.08',
      rotate: '-30deg',
      zIndex: 9999,
      style: ''
    }
    watermark({
      content: `${options?.title || defaultOptions.title} - ${options.name} - ${options.email.match(/^(.+)@.+$/)[1]}`,
      ...defaultOptions
    })
  }
}
